<template>
  <!-- 心理知识页面 -->
  <div>
    <Nav></Nav>
    <KnowledgeCarousel></KnowledgeCarousel>
    <KnowledgeList :carouselList="carouselList" :total="total"></KnowledgeList>
  </div>
</template>

<script>
import Nav from "@/components/common/Nav.vue";

import KnowledgeCarousel from "@/components/knowledge/KnowledgeCarousel.vue";
import KnowledgeList from "@/components/knowledge/KnowledgeList.vue";

export default {
  name: "Knowledge",
  components: { Nav, KnowledgeCarousel, KnowledgeList },
  data() {
    return {
      carouselList: [],
      total: 0,
    };
  },
  created() {
    this.getKnowledgeList();
  },
  methods: {
    getKnowledgeList() {
      this.$request.getHttp({
        url: "/knowledge/getKnowledgeList",
        params: {
          isCarousel: 0,
        },
        success: (data) => {
          console.log(data);
          if (data.code == 200) {
            this.carouselList = data.list;
            this.total = this.carouselList.length;
          }
        },
        error: (error) => {},
      });
    },
  },
};
</script>

<style scoped>
</style>
